import Cookies from 'js-cookie'

const TokenKey = 'hrkj-token'
const NameKey = 'hrkj-name'
const AvatarKey = 'hrkj-avatar'

export function getToken() {
  return Cookies.get(TokenKey)
}
export function getName() {
  return Cookies.get(NameKey)
}
export function getAvatar() {
  return Cookies.get(AvatarKey)
}

// ===========================
// 把从登陆API中获取到的token存入cookie中
export function setToken(token) {
  return Cookies.set(TokenKey, token)
}
export function setName(name) {
  return Cookies.set(NameKey, name)
}
export function setAvatar(avatar) {
  return Cookies.set(AvatarKey, avatar)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}
